Skip to content

fix(security): handle few security issues#8

Open
seqre wants to merge 6 commits into
mainfrom
security-fixes
Open

fix(security): handle few security issues#8
seqre wants to merge 6 commits into
mainfrom
security-fixes

Conversation

@seqre
Copy link
Copy Markdown
Member

@seqre seqre commented May 24, 2026

No description provided.

seqre and others added 4 commits May 24, 2026 23:52
Some deserializing libraries embed the (secret) input in their error
messages. Drop the `{error}` interpolation from the three byte
deserialization paths so password fragments cannot leak via serde errors.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
`mlock` now returns whether the region was actually locked (it can fail,
e.g. on RLIMIT_MEMLOCK). Each secure type stores an `is_locked` flag and
only calls the paired `munlock` when locking succeeded, avoiding munlock
on a region this type never locked.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The previous SecureArray stored `[T; LENGTH]` inline and mlocked the
local before moving it into the returned value, so the lock applied to a
stale address; any later move of the SecureArray relocated the bytes and
left the lock behind. Wrap a `SecureBox<[T; LENGTH]>` instead so the data
has a stable heap address and the mlock stays valid across moves.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
`unsecure_mut` returns a borrow of the secret; ignoring it is a no-op.
Annotate it across SecureString, SecureVec, and SecureBox for parity with
the already-annotated `unsecure`/`into_unsecure`.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@seqre seqre self-assigned this May 24, 2026
@seqre seqre force-pushed the security-fixes branch from 6d06564 to d8567f4 Compare May 25, 2026 16:57
Use `PhantomData` directly instead of `Default::default()`
(default_trait_access) and elide the `'de` lifetime on the
SecureStringVisitor Visitor impl (elidable_lifetime_names).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@seqre seqre force-pushed the security-fixes branch from d8567f4 to 8b440f2 Compare May 25, 2026 17:01
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@seqre seqre marked this pull request as ready for review May 25, 2026 17:31
@seqre seqre requested review from ElijahAhianyo and m4tx May 25, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant